<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>v-on修饰符</title>
  </head>
  <body>
    <div id="app">
      <!-- 1. .stop修饰符的使用 -->
      <div @click="divClick">
        aaaaaaaa
        <button @click.stop="btnClick">按钮</button>
      </div>

      <!-- 2. .prevent修饰符的使用 -->
      <form action="baidu">
        <input type="submit" value="提交" @click.prevent="submitClick" />
      </form>
      <br />

      <!-- 3. .监听键盘的事件 -->
      <input type="text" @keyup="keyup" />
      <br />
      <!-- 3.2 .监听某个确定的键盘的事件 -->
      <input type="text" @keyup.enter="keyup" />
      <!-- 4. .once修饰符的使用 -->
      <br />
      <div>
        <button @click.once="newButtonClick">新按钮</button>
      </div>
    </div>
    <script src="../vue.js"></script>
    <script>
      const app = new Vue({
        el: "#app",
        data: {
          message: "hello",
        },
        methods: {
          btnClick() {
            console.log(" btnClick");
          },
          divClick() {
            console.log("divClick");
          },
          submitClick() {
            console.log("submitClick");
          },
          keyup() {
            console.log("keyup");
          },
          newButtonClick() {
            console.log("newButtonClick");
          },
        },
      });
    </script>
  </body>
</html>
